package com.tczs.server;

import com.tczs.server.request.AbstractGetMethodBuildParameter;
import com.tczs.server.request.DefaultGetMethodBuildParameter;
import com.tczs.server.request.DefaultServerBuildRequest;
import com.tczs.server.request.ServerBuildRequest;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.timeout.IdleStateHandler;

@Sharable
public class SunChannelInitializer extends ChannelInitializer<SocketChannel>{

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new IdleStateHandler(5,5, 0));
        pipeline.addLast(new TimeOutHandler());
        pipeline.addLast(new HttpServerCodec());
        pipeline.addLast(new HttpObjectAggregator(512 * 1024));
        pipeline.addLast(new HttpExecuteHandler());
    }
}
